<template>
	<view class="content b-box d-flex flex-r ali-i-c just-e">
		<!-- 启动页 -->
		<view
			style="width: 100vw;height: 100vh;z-index: 1;top: 0;right: 0;left: 0;"
			class="b-box po-re"
		>
			<image
				:src="require('@/static/indexlogo.png')"
				style="width: 100vw;height: 100vh;"
				mode="scaleToFill"
			></image>
		</view>
		<!--  -->
		<view
			class="po-fx b-box d-flex flex-c ali-i-c just-e"
			style="width:100vw;height:100vh;top: 0;right: 0;left: 0;z-index: 99;background-color: rgba(255,255,2555,0);"
		>
			<view style="flex: 1;"></view>
			<view class="content-box d-flex flex-c just-sw" style="">
				<view class="d-flex flex-r ali-i-c just-sw">
					<view class="btn d-flex flex-r ali-i-c just-c" @click="GoUserPage(2)">
						<view style="width: 64rpx;height: 70rpx;margin-right: 16rpx;">
							<image
								:src="require('@/static/icon/qidong1.png')"
								style="width: 64rpx;height: 70rpx;"
								mode=""
							></image>
						</view>
						<view
							class="d-flex flex-c ali-i-c just-sw"
							style="width: 64rpx;height: 88rpx;margin-left: 16rpx;"
						>
							<text class="c-000 pf-sc fw-500 fz-32">上门</text>
							<text class="c-000 pf-sc fw-500 fz-32">洗车</text>
						</view>
					</view>
					<view class="btn d-flex flex-r ali-i-c just-c" @click="GoUserPage(0)">
						<view style="width: 69rpx;height: 62rpx;margin-right: 12rpx;">
							<image
								:src="require('@/static/icon/nianshen.png')"
								style="width: 69rpx;height: 62rpx;"
								mode=""
							></image>
						</view>
						<view
							class="d-flex flex-c ali-i-c just-sw"
							style="width: 64rpx;height: 88rpx;margin-left: 12rpx;"
						>
							<text class="c-000 pf-sc fw-500 fz-32">年审</text>
							<text class="c-000 pf-sc fw-500 fz-32">登录</text>
						</view>
					</view>
				</view>
				<view class="d-flex flex-r ali-i-c just-sw">
					<view class="btn d-flex flex-r ali-i-c just-c" @click="GoStaffPage(1)">
						<view style="width: 68rpx;height: 51rpx;margin-right: 15rpx;">
							<image
								:src="require('@/static/icon/qidong3.png')"
								style="width: 68rpx;height: 51rpx;"
								mode=""
							></image>
						</view>
						<view
							class="d-flex flex-c ali-i-c just-sw"
							style="width: 64rpx;height: 88rpx;margin-left: 15rpx;"
						>
							<text class="c-000 pf-sc fw-500 fz-32">师傅</text>
							<text class="c-000 pf-sc fw-500 fz-32">认证</text>
						</view>
					</view>
					<view class="btn d-flex flex-r ali-i-c just-c" @click="GoStaffPage(0)">
						<view style="width: 68rpx;height: 68rpx;margin-right: 18rpx;">
							<image
								:src="require('@/static/icon/qidong4.png')"
								style="width: 68rpx;height: 68rpx;"
								mode=""
							></image>
						</view>
						<view
							class="d-flex flex-c ali-i-c just-sw"
							style="width: 64rpx;height: 88rpx;margin-left: 18rpx;"
						>
							<text class="c-000 pf-sc fw-500 fz-32">师傅</text>
							<text class="c-000 pf-sc fw-500 fz-32">登录</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<login
			:loadModal="loadModal"
			@showlogin="showlogin"
			:sharid="sharid"
			@hidelogin="hidelogin"
		></login>
	</view>
</template>

<script>
import login from '@/components/login';
import { _screenHeight, _windowWidth, _addUnit, _rpxTpx } from '@/utils/GetSys.js';
export default {
	components: {
		login
	},
	data() {
		return {
			loadModal: false,
			winWidth: '',
			winHeight: '',
			EmptyHeight: '',
			sharid: ''
		};
	},
	onShow() {
		if (uni.getStorageSync('CurrentClient')) {
			uni.switchTab({
				url: '/pages/UserHomePage/UserHomePage'
			});
		}
		/* 	  if(uni.getStorageSync('CurrentClient')==1){
		  uni.switchTab({
		  	url:'/pages/UserHomePage/UserHomePage'
		  })
	  }else if(uni.getStorageSync('CurrentClient')==0){
		 uni.switchTab({
		  	url:'/pages/UserHomePage/UserHomePage'
		  })
	  } */
		// if (!uni.getStorageSync('userCent')) {
		// 	this.loadModal = true;
		// }
	},

	methods: {
		hidelogin(type) {
			console.log(type);
			this.loadModal = false;
		},
		GoStaffPage(val) {
			//跳转到师傅端操作界面
			// this.$store.commit('CommitCurrentClient',1);
			if (val) {
				/* if(!uni.getStorageSync('userCent')){
					this.loadModal=true;
					return false
				}  */
				// 师傅认证
				uni.navigateTo({
					url: `/staffModelA/staffB/Authentication/Authentication`
				});
			}
			if (!val) {
				// 师傅登录
				console.log(val);
				uni.navigateTo({
					url: `/staffModelA/staffB/LogOn/LogOn`
				});
			}
		},
		GoUserPage(val) {
			//跳转到用户端
			// if (val === 1) {
			// 	uni.reLaunch({
			// 		url: `/pages/UserHomePage/UserHomePage`
			// 	});
			// 	uni.setStorageSync('CurrentClient', 0);
			// }
			if (val === 0) {
				if (uni.getStorageSync('AnnuallyUser').token) {
					uni.navigateTo({
						url: `/pages/AnnuallyIndex/AnnuallyIndex?type=${'index'}`
					});
				} else {
					uni.navigateTo({
						url: `/pages/AnnuallyLogin/AnnuallyLogin?type=${'index'}`
					});
				}
			}

			if (val === 2) {
				if (!uni.getStorageSync('usertoken')) {
					this.loadModal = true;
				} else {
					uni.reLaunch({
						url: `/pages/UserHomePage/UserHomePage`
					});
				}
				uni.setStorageSync('CurrentClient', 0);
			}
		}
	},
	onLoad(e) {
		console.log(e, '参数！！！！');
		if (e.scene) {
			this.sharid = e.scene;
			console.log(e.scene);
		}
		this.winHeight = _addUnit(_screenHeight(), 'px');
		this.winWidth = _addUnit(_windowWidth(), 'px');
	}
};
</script>

<style lang="scss">
.content {
	z-index: 10;
	.content-box {
		width: 630rpx;
		height: 350rpx;
		margin-bottom: 100rpx;
		.btn {
			width: 304rpx;
			height: 164rpx;
			background: #ffffff;
			opacity: 1;
			border-radius: 16rpx;
		}
	}
}
</style>
